.class public Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;
.super Ljava/lang/Object;
.source "CarByPriceParser.java"


# static fields
.field private static final FIRSTLETTER:Ljava/lang/String; = "FirstLetter"

.field private static final ID:Ljava/lang/String; = "Id"

.field private static final IMAGE:Ljava/lang/String; = "Image"

.field private static final MAXVALUE:Ljava/lang/String; = "MaxValue"

.field private static final MINVALUE:Ljava/lang/String; = "MinValue"

.field private static final NAME:Ljava/lang/String; = "EName"

.field private static final PV:Ljava/lang/String; = "PV"


# instance fields
.field private final TAG:Ljava/lang/String;

.field private list:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;",
            ">;"
        }
    .end annotation
.end field

.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 1
    .parameter "url"

    .prologue
    .line 33
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 28
    const-string v0, "CarByPriceParser"

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;->TAG:Ljava/lang/String;

    .line 31
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;->url:Ljava/lang/String;

    .line 34
    iput-object p1, p0, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;->url:Ljava/lang/String;

    .line 35
    return-void
.end method

.method private createCar(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;
    .locals 3
    .parameter "obj"

    .prologue
    .line 59
    new-instance v0, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;

    invoke-direct {v0}, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;-><init>()V

    .line 61
    .local v0, ct:Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;
    :try_start_0
    const-string v2, "Image"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;->setcImage(Ljava/lang/String;)V

    .line 62
    const-string v2, "EName"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;->setcName(Ljava/lang/String;)V

    .line 63
    const-string v2, "FirstLetter"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;->setcFirstLetter(Ljava/lang/String;)V

    .line 64
    const-string v2, "MinValue"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;->setcMinValue(Ljava/lang/String;)V

    .line 65
    const-string v2, "MaxValue"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;->setcMaxValue(Ljava/lang/String;)V

    .line 66
    const-string v2, "PV"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;->setcPv(Ljava/lang/String;)V

    .line 67
    const-string v2, "Id"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;->setcId(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-object v2, v0

    .line 72
    :goto_0
    return-object v2

    .line 70
    :catch_0
    move-exception v2

    move-object v1, v2

    .line 71
    .local v1, e:Lorg/json/JSONException;
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    .line 72
    const/4 v2, 0x0

    goto :goto_0
.end method


# virtual methods
.method public Parser2Obj()V
    .locals 7

    .prologue
    .line 39
    :try_start_0
    new-instance v5, Ljava/util/ArrayList;

    invoke-direct {v5}, Ljava/util/ArrayList;-><init>()V

    iput-object v5, p0, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;->list:Ljava/util/ArrayList;

    .line 41
    iget-object v5, p0, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;->url:Ljava/lang/String;

    invoke-static {v5}, Lcom/bitauto/autoeasy/tool/Caller;->doGet(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    .line 42
    .local v4, str:Ljava/lang/String;
    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3, v4}, Lorg/json/JSONArray;-><init>(Ljava/lang/String;)V

    .line 43
    .local v3, jarr:Lorg/json/JSONArray;
    invoke-virtual {v3}, Lorg/json/JSONArray;->length()I

    move-result v5

    if-lez v5, :cond_0

    .line 44
    const/4 v2, 0x0

    .local v2, i:I
    :goto_0
    invoke-virtual {v3}, Lorg/json/JSONArray;->length()I

    move-result v5

    if-lt v2, v5, :cond_1

    .line 56
    .end local v2           #i:I
    .end local v3           #jarr:Lorg/json/JSONArray;
    .end local v4           #str:Ljava/lang/String;
    :cond_0
    :goto_1
    return-void

    .line 45
    .restart local v2       #i:I
    .restart local v3       #jarr:Lorg/json/JSONArray;
    .restart local v4       #str:Ljava/lang/String;
    :cond_1
    invoke-virtual {v3, v2}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v5

    invoke-direct {p0, v5}, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;->createCar(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;

    move-result-object v0

    .line 47
    .local v0, ct:Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;
    iget-object v5, p0, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;->list:Ljava/util/ArrayList;

    invoke-virtual {v5, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Lcom/bitauto/autoeasy/tool/WSError; {:try_start_0 .. :try_end_0} :catch_1

    .line 44
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    .line 50
    .end local v0           #ct:Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;
    .end local v2           #i:I
    .end local v3           #jarr:Lorg/json/JSONArray;
    .end local v4           #str:Ljava/lang/String;
    :catch_0
    move-exception v5

    move-object v1, v5

    .line 51
    .local v1, e:Lorg/json/JSONException;
    const/4 v5, 0x0

    iput-object v5, p0, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;->list:Ljava/util/ArrayList;

    .line 52
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_1

    .line 53
    .end local v1           #e:Lorg/json/JSONException;
    :catch_1
    move-exception v5

    move-object v1, v5

    .line 54
    .local v1, e:Lcom/bitauto/autoeasy/tool/WSError;
    const-string v5, "CarByPriceParser"

    invoke-virtual {v1}, Lcom/bitauto/autoeasy/tool/WSError;->getMessage()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1
.end method

.method public getList()Ljava/util/ArrayList;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceType;",
            ">;"
        }
    .end annotation

    .prologue
    .line 17
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CarByPriceParser;->list:Ljava/util/ArrayList;

    return-object v0
.end method
